package com.study8.demo8;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import java.io.IOException;

@SpringBootApplication
public class Demo8Application {

	public static void main(String[] args) {

//		SpringApplication.run(Demo8Application.class, args);

		int port = 8182;
		String portPrefix = "--server.port=";
		for (String arg : args) {
			if (arg.startsWith(portPrefix)) {
				port = Integer.parseInt(arg.substring(portPrefix.length()));
			}
		}
		SpringApplication.run(Demo8Application.class, args);
		try {
			Runtime.getRuntime().exec("cmd /c start http://localhost:" + port + "/upload");
		} catch (IOException e) {
			e.printStackTrace();
		}

	}

}
